#include<iostream>
#include<unistd.h>
#include<signal.h>

void handler(int sig)
{
    std::cout<<"收到"<<sig<<"号信号"<<std::endl;
}
int main()
{
    signal(2,handler);
    while(true)
    {
        std::cout<<"hello Kill,my pid = "<<getpid()<<std::endl;
        sleep(1);
    }
    return 0;
}